home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / comms / non-internet / samba / source / includes.h < prev    next >
C/C++ Source or Header  |  1996-06-26  |  21KB  |  1,115 lines

  1. #ifndef _INCLUDES_H
  2. #define _INCLUDES_H
  3. /* 
  4.    Unix SMB/Netbios implementation.
  5.    Version 1.9.
  6.    Machine customisation and include handling
  7.    Copyright (C) Andrew Tridgell 1994-1995
  8.    
  9.    This program is free software; you can redistribute it and/or modify
  10.    it under the terms of the GNU General Public License as published by
  11.    the Free Software Foundation; either version 2 of the License, or
  12.    (at your option) any later version.
  13.    
  14.    This program is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.    GNU General Public License for more details.
  18.    
  19.    You should have received a copy of the GNU General Public License
  20.    along with this program; if not, write to the Free Software
  21.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */
  23. /*
  24.    This file does all the #includes's. This makes it easier to
  25.    port to a new unix. Hopefully a port will only have to edit the Makefile
  26.    and add a section for the new unix below.
  27. */
  28.  
  29.  
  30. /* the first OS dependent section is to setup what includes will be used.
  31.    the main OS dependent section comes later on 
  32. */
  33.  
  34. #ifdef ALTOS
  35. #define NO_UTIMEH
  36. #endif
  37.  
  38. #ifdef MIPS
  39. #define POSIX_H
  40. #define NO_UTIMEH
  41. #endif
  42.  
  43. #ifdef sun386
  44. #define NO_UTIMEH
  45. #endif
  46.  
  47. #ifdef NEXT2
  48. #define NO_UTIMEH
  49. #endif
  50.  
  51. #ifdef NEXT3_0
  52. #define NO_UTIMEH
  53. #define NO_UNISTDH
  54. #endif
  55.  
  56. #ifdef APOLLO
  57. #define NO_UTIMEH
  58. #define NO_SYSMOUNTH
  59. #define NO_UNISTDH
  60. #endif
  61.  
  62. #ifdef AIX
  63. #define NO_SYSMOUNTH
  64. #endif
  65.  
  66. #ifdef M88K_R3
  67. #define SVR3H
  68. #define NO_RESOURCEH
  69. #endif
  70.  
  71. #ifdef DNIX
  72. #define NO_SYSMOUNTH
  73. #define NO_NETIFH
  74. #define NO_RESOURCEH
  75. #define PRIME_NMBD 0
  76. #define NO_SETGROUPS
  77. #endif
  78.  
  79.  
  80. #ifdef ISC
  81. #define SYSSTREAMH
  82. #define NO_RESOURCEH
  83. #endif
  84.  
  85. #ifdef QNX
  86. #define NO_RESOURCEH
  87. #define NO_SYSMOUNTH
  88. #define USE_MMAP 1
  89. #ifdef __386__
  90.    #define __i386__
  91. #endif
  92. #endif
  93.  
  94. #ifdef NEWS42
  95. #define NO_UTIMEH
  96. #define NO_STRFTIME
  97. #define NO_UTIMBUF
  98. #define REPLACE_MKTIME
  99. #define NO_TM_NAME
  100. #endif
  101.  
  102. #ifdef OS2
  103. #define NO_SYSMOUNTH
  104. #define NO_NETIFH
  105. #endif
  106.  
  107.  
  108. #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
  109. #define PASSWORD_LENGTH 16
  110. #endif
  111.  
  112. /* here is the general includes section - with some ifdefs generated 
  113.    by the previous section 
  114. */
  115. #include "local.h"
  116. #include <stdio.h>
  117. #ifdef POSIX_STDLIBH
  118. #include <posix/stdlib.h>
  119. #else
  120. #include <stdlib.h>
  121. #endif
  122. #include <ctype.h>
  123. #include <time.h>
  124. #ifndef NO_UTIMEH
  125. #include <utime.h>
  126. #endif
  127. #include <sys/types.h>
  128.  
  129. #ifdef SVR3H
  130. #include <sys/statfs.h>
  131. #include <sys/stream.h>
  132. #include <netinet/types.h>
  133. #include <netinet/ether.h>
  134. #include <netinet/ip_if.h>
  135. #endif
  136.  
  137. #include <sys/socket.h>
  138. #include <sys/ioctl.h>
  139. #include <stddef.h>
  140. #ifdef POSIX_H
  141. #include <posix/utime.h>
  142. #include <bsd/sys/time.h>
  143. #include <bsd/netinet/in.h>
  144. #else
  145. #include <sys/time.h>
  146. #include <netinet/in.h>
  147. #endif 
  148. #include <netdb.h>
  149. #include <signal.h>
  150. #include <errno.h>
  151. #include <sys/file.h>
  152. #include <sys/stat.h>
  153. #include <sys/param.h>
  154. #include <grp.h>
  155. #ifndef NO_RESOURCEH
  156. #include <sys/resource.h>
  157. #endif
  158. #ifndef NO_SYSMOUNTH
  159. #include <sys/mount.h>
  160. #endif
  161. #include <pwd.h>
  162. #ifdef __STDC__
  163. #include <stdarg.h>
  164. #else
  165. #include <varargs.h>
  166. #endif
  167. #ifndef NO_UNISTDH
  168. #include <unistd.h>
  169. #endif
  170. #include <sys/wait.h>
  171. #ifdef SYSSTREAMH
  172. #include <sys/stream.h>
  173. #endif
  174. #ifndef NO_NETIFH
  175. #ifdef POSIX_H
  176. #include <bsd/net/if.h>
  177. #else
  178. #include <net/if.h>
  179. #endif
  180. #endif
  181.  
  182. #if USE_MMAP
  183. #include <sys/mman.h>
  184. #endif
  185.  
  186. #if defined(GETPWANAM)
  187. #include <sys/types.h>
  188. #include <sys/label.h>
  189. #include <sys/audit.h>
  190. #include <pwdadj.h>
  191. #endif
  192.  
  193. #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(CONVEX)
  194. #include <shadow.h>
  195. #endif
  196.  
  197. /* this might be different on different systems */
  198. #ifdef QUOTAS 
  199. #include <sys/quota.h>
  200. #ifndef CRAY
  201. #include <devnm.h>
  202. #else
  203. #include <mntent.h>
  204. #endif
  205. #endif
  206.  
  207. #ifdef SYSLOG
  208. #include <syslog.h>
  209. #endif
  210.  
  211.  
  212.  
  213. /***************************************************************************
  214. Here come some platform specific sections
  215. ***************************************************************************/
  216.  
  217.  
  218. #ifdef LINUX
  219. #include <arpa/inet.h>
  220. #include <dirent.h>
  221. #include <string.h>
  222. #include <sys/vfs.h>
  223. #include <netinet/in.h>
  224. #ifndef NO_ASMSIGNALH
  225. #include <asm/signal.h>
  226. #endif
  227. #define SIGNAL_CAST (__sighandler_t)
  228. #define USE_GETCWD
  229. #define USE_SETSID
  230. #define HAVE_BZERO
  231. #define HAVE_MEMMOVE
  232. #ifdef SHADOW_PWD
  233. #ifndef crypt
  234. #define crypt pw_encrypt
  235. #endif
  236. #endif
  237. #endif
  238.  
  239. #ifdef SUNOS4
  240. #define SIGNAL_CAST (void (*)(int))
  241. #include <netinet/tcp.h>
  242. #include <dirent.h>
  243. #include <sys/acct.h>
  244. #include <sys/vfs.h>
  245. #include <string.h>
  246. #include <errno.h>
  247. #include <sys/wait.h>
  248. #include <signal.h>
  249. /* #include <termios.h> */
  250. #ifdef sun386
  251. #define NO_STRFTIME
  252. #define NO_UTIMBUF
  253. #define mktime timelocal
  254. typedef unsigned short mode_t;
  255. #else
  256. #include <utime.h>
  257. #define NO_STRERROR
  258. #endif
  259. #define REPLACE_GETPASS
  260. #define BSD_TERMIO
  261. #endif
  262.  
  263.  
  264. #ifdef SUNOS5
  265. #include <fcntl.h>
  266. #include <dirent.h>
  267. #include <sys/acct.h>
  268. #include <sys/statfs.h>
  269. #include <sys/statvfs.h>
  270. #include <sys/filio.h>
  271. #include <sys/sockio.h>
  272. #include <netinet/in_systm.h>
  273. #include <netinet/tcp.h>
  274. #include <netinet/ip.h>
  275. #include <string.h>
  276. #include <arpa/inet.h>
  277. #include <rpcsvc/ypclnt.h>
  278. #include <crypt.h> 
  279. #include <termios.h>
  280. extern int gettimeofday (struct timeval *, void *);
  281. extern int gethostname (char *name, int namelen);
  282. extern int innetgr (const char *, const char *, const char *, const char *);
  283. #define USE_SETVBUF
  284. #define SIGNAL_CAST (void (*)(int))
  285. #ifndef SYSV
  286. #define SYSV
  287. #endif
  288. #define USE_WAITPID
  289. #define REPLACE_STRLEN
  290. #define USE_STATVFS
  291. #define USE_GETCWD
  292. #define USE_SETSID
  293. #define REPLACE_GETPASS
  294. #endif
  295.  
  296.  
  297. #ifdef ULTRIX
  298. #include <strings.h>
  299. #include <nfs/nfs_clnt.h>
  300. #include <nfs/vfs.h>
  301. #include <netinet/tcp.h>
  302. #ifdef ULTRIX_AUTH
  303. #include <auth.h>
  304. #endif
  305. char *getwd(char *);
  306. #define NOSTRDUP
  307. #ifdef __STDC__
  308. #define SIGNAL_CAST (void(*)(int))
  309. #endif
  310. #define USE_DIRECT
  311. #endif
  312.  
  313. #ifdef SGI
  314. #include <netinet/tcp.h>
  315. #include <sys/statfs.h>
  316. #include <string.h>
  317. #include <signal.h>
  318. #ifndef SYSV
  319. #define SYSV
  320. #endif
  321. #define SIGNAL_CAST (void (*)())
  322. #define STATFS4
  323. #define USE_WAITPID
  324. #define USE_DIRECT
  325. #endif
  326.  
  327. #ifdef SGI5
  328. #include <netinet/tcp.h>
  329. #include <sys/statvfs.h>
  330. #include <string.h>
  331. #include <signal.h>
  332. #include <dirent.h>
  333. #define USE_WAITPID
  334. #define NETGROUP 
  335. #ifndef SYSV
  336. #define SYSV
  337. #endif
  338. #define SIGNAL_CAST (void (*)())
  339. #define USE_STATVFS
  340. #define USE_WAITPID
  341. #endif
  342.  
  343.  
  344. #ifdef MIPS
  345. #include <bsd/net/soioctl.h>
  346. #include <string.h>
  347. #include <dirent.h>
  348. #include <fcntl.h>
  349. #include <sys/statfs.h>
  350. #include <sys/wait.h>
  351. #include <sys/termio.h>
  352. #define SIGNAL_CAST (void (*)())
  353. typedef int mode_t;
  354. extern struct group *getgrnam();
  355. extern struct passwd *getpwnam();
  356. #define STATFS4
  357. #define NO_STRERROR
  358. #define REPLACE_STRSTR
  359. #endif /* MIPS */
  360.  
  361.  
  362.  
  363. #ifdef DGUX
  364. #include <string.h>
  365. #include <dirent.h>
  366. #include <sys/statfs.h>
  367. #include <sys/statvfs.h>
  368. #include <fcntl.h>
  369. #include <termios.h>
  370. #define SYSV
  371. #define USE_WAITPID
  372. #define SIGNAL_CAST (void (*)(int))
  373. #define STATFS4
  374. #define USE_GETCWD
  375. #endif
  376.  
  377.  
  378. #ifdef SVR4
  379. #include <string.h>
  380. #include <sys/dir.h>
  381. #include <dirent.h>
  382. #include <sys/statfs.h>
  383. #include <sys/statvfs.h>
  384. #include <sys/vfs.h>
  385. #include <sys/filio.h>
  386. #include <fcntl.h>
  387. #include <sys/sockio.h>
  388. #include <netinet/tcp.h>
  389. #include <stropts.h>
  390. #include <termios.h>
  391. #define SYSV
  392. #define USE_WAITPID
  393. #define SIGNAL_CAST (void (*)(int))
  394. #define USE_STATVFS
  395. #define USE_GETCWD
  396. #endif
  397.  
  398.  
  399. #ifdef OSF1
  400. #include <termios.h>
  401. #include <strings.h>
  402. #include <dirent.h>
  403. char *getwd(char *);
  404. char *mktemp(char *); /* No standard include */
  405. #include <netinet/in.h>
  406. #include <arpa/inet.h> /* both for inet_ntoa */
  407. #define SIGNAL_CAST ( void (*) (int) )
  408. #define STATFS3
  409. #define USE_F_FSIZE
  410. #include <netinet/tcp.h>
  411. #ifdef OSF1_ENH_SEC
  412. #include <pwd.h>
  413. #include <sys/types.h>
  414. #include <sys/security.h>
  415. #include <prot.h>
  416. #include <unistd.h>
  417. #define PASSWORD_LENGTH 16
  418. #endif  /* OSF1_ENH_SEC */
  419. #endif
  420.  
  421.  
  422. #ifdef CLIX
  423. #include <dirent.h>
  424. #define SIGNAL_CAST    (void (*)())
  425. #include <sys/fcntl.h>
  426. #include <sys/statfs.h>
  427. #include <string.h>
  428. #define NO_EID
  429. #define USE_WAITPID
  430. #define STATFS4
  431. #define NO_FSYNC
  432. #define USE_GETCWD
  433. #define USE_SETSID
  434. #define REPLACE_GETPASS
  435. #define NO_GETRLIMIT
  436. #endif    /* CLIX */
  437.  
  438.  
  439.  
  440. #ifdef BSDI
  441. #include <string.h>
  442. #include <netinet/tcp.h>
  443. #define SIGNAL_CAST (void (*)())
  444. #define USE_DIRECT
  445. #endif
  446.  
  447.  
  448. #ifdef NETBSD
  449. #include <strings.h>
  450. #include <netinet/tcp.h>
  451. /* you may not need this */
  452. #define NO_GETSPNAM
  453. #define SIGNAL_CAST (void (*)())
  454. #define USE_DIRECT
  455. #define REPLACE_INNETGR
  456. #endif 
  457.  
  458.  
  459.  
  460. #ifdef FreeBSD
  461. #include <strings.h>
  462. #include <netinet/tcp.h>
  463. #include <netinet/in_systm.h>
  464. #include <netinet/ip.h>
  465. #define SIGNAL_CAST (void (*)())
  466. #define USE_DIRECT
  467. #define REPLACE_INNETGR
  468. #endif 
  469.  
  470.  
  471.  
  472. #ifdef AIX
  473. #include <strings.h>
  474. #include <sys/dir.h>
  475. #include <sys/select.h>
  476. #include <dirent.h>
  477. #include <sys/statfs.h>
  478. #include <sys/vfs.h>
  479. #include <sys/id.h>
  480. #include <sys/priv.h>
  481. #include <netinet/tcp.h>
  482. #define SYSV
  483. #define USE_WAITPID
  484. #define SIGNAL_CAST (void (*)())
  485. #define DEFAULT_PRINTING PRINT_AIX
  486. #endif
  487.  
  488.  
  489. #ifdef HPUX
  490. #include <string.h>
  491. #include <dirent.h>
  492. #include <fcntl.h>
  493. #include <sys/vfs.h>
  494. #include <sys/types.h>
  495. #include <sys/termios.h>
  496. #include <netinet/tcp.h>
  497. #define SIGNAL_CAST (void (*)(__harg))
  498. #define SELECT_CAST (int *)
  499. #define SYSV
  500. #define USE_WAITPID
  501. #define WAIT3_CAST2 (int *)
  502. #define USE_GETCWD
  503. #define USE_SETSID
  504. #define USE_SETRES
  505. #define DEFAULT_PRINTING PRINT_HPUX
  506. #define SIGCLD_IGNORE
  507. #endif
  508.  
  509.  
  510. #ifdef SEQUENT
  511. #include <signal.h>
  512. #include <string.h>
  513. #include <dirent.h>
  514. #include <sys/types.h>
  515. #include <sys/statfs.h>
  516. #include <sys/stat.h>
  517. #include <sys/buf.h>
  518. #include <sys/socket.h>
  519. #include <unistd.h>
  520. #include <fcntl.h>
  521. #define SIGNAL_CAST (void (*)(int))
  522. #define USE_WAITPID
  523. #define USE_GETCWD
  524. #define NO_EID
  525. #define STATFS4
  526. #define USE_DIRECT
  527. #endif
  528.  
  529. #ifdef NEXT2
  530. #include <sys/types.h>
  531. #include <strings.h>
  532. #include <dirent.h>
  533. #include <sys/vfs.h>
  534. #define bzero(b,len) memset(b,0,len)
  535. #define mode_t int
  536. #define NO_UTIMBUF
  537. #include <libc.h>
  538. #define NOSTRDUP
  539. #define USE_DIRECT
  540. #define USE_WAITPID
  541. #endif 
  542.  
  543.  
  544. #ifdef NEXT3_0
  545. #include <strings.h>
  546. #include <sys/dir.h>
  547. #include <sys/vfs.h>
  548. #define bzero(b,len) memset(b,0,len)
  549. #define NO_UTIMBUF
  550. #include <libc.h>
  551. #define NOSTRDUP
  552. #define USE_DIRECT
  553. #define mode_t int
  554. #define GID_TYPE int
  555. #define gid_t int
  556. #define SIGNAL_CAST (void (*)(int))
  557. #define WAIT3_CAST1 (union wait *)
  558. #endif
  559.  
  560.  
  561.  
  562. #ifdef APOLLO
  563. #include <string.h>
  564. #include <fcntl.h>
  565. #include <sys/statfs.h>
  566. #define NO_UTIMBUF
  567. #define USE_DIRECT
  568. #define USE_GETCWD
  569. #define SIGNAL_CAST     (void (*)())
  570. #define HAVE_FCNTL_LOCK 0
  571. #define HAVE_GETTIMEOFDAY
  572. #define STATFS4
  573. #endif
  574.  
  575.  
  576.  
  577. #ifdef SCO
  578. #include <sys/netinet/tcp.h>
  579. #include <sys/netinet/in_systm.h>
  580. #include <sys/netinet/ip.h>
  581. #include <dirent.h>
  582. #include <string.h>
  583. #include <fcntl.h>
  584. #include <sys/statfs.h>
  585. #include <sys/stropts.h>
  586. #include <limits.h>
  587. #ifdef EVEREST
  588. #include <unistd.h> 
  589. #endif
  590. #ifdef NETGROUP
  591. #include <rpcsvc/ypclnt.h>
  592. #endif
  593. #ifdef SecureWare
  594. #include <sys/security.h>
  595. #include <sys/audit.h>
  596. #include <prot.h>
  597. #define crypt bigcrypt
  598. #endif
  599. #ifndef EVEREST
  600.  #define ftruncate(f,l) syscall(0x0a28,f,l)
  601. #endif 
  602. #define SIGNAL_CAST (void (*)(int))
  603. #define USE_WAITPID
  604. #define USE_GETCWD
  605. #define USE_SETSID
  606. #ifdef SCO3_2_2
  607. #define NO_EID
  608. #else
  609. #ifndef EVEREST
  610. #define USE_IFREQ
  611. #endif
  612. #endif
  613. #define STATFS4
  614. #define NO_FSYNC
  615. #ifndef EVEREST
  616. #define NO_INITGROUPS
  617. #endif
  618. #define HAVE_PATHCONF
  619. #define NO_GETRLIMIT
  620. #endif
  621.  
  622.  
  623.  
  624. /* Definitions for RiscIX */
  625. #ifdef RiscIX
  626. #define SIGNAL_CAST (void (*)(int))
  627. #include <sys/dirent.h>
  628. #include <sys/acct.h>
  629. #include <sys/vfs.h>
  630. #include <string.h>
  631. #include <utime.h>
  632. #include <signal.h>
  633. #define HAVE_GETTIMEOFDAY
  634. #define NOSTRCASECMP
  635. #define NOSTRDUP
  636. #endif
  637.  
  638.  
  639.  
  640. #ifdef ISC
  641. #include <net/errno.h>
  642. #include <string.h>
  643. #include <sys/dir.h>
  644. #include <dirent.h>
  645. #include <sys/statfs.h>
  646. #include <fcntl.h>
  647. #include <sys/sioctl.h>
  648. #include <stropts.h>
  649. #include <limits.h>
  650. #include <netinet/tcp.h>
  651. #define FIONREAD FIORDCHK
  652. #define SYSV
  653. #define USE_WAITPID
  654. #define SIGNAL_CAST (void (*)(int))
  655. #define USE_GETCWD
  656. #define USE_SETSID
  657. #define USE_IFREQ
  658. #define NO_FTRUNCATE
  659. #define STATFS4
  660. #define NO_FSYNC
  661. #endif
  662.  
  663.  
  664.  
  665. #ifdef AUX
  666. #include <fstab.h>
  667. #include <string.h>
  668. #include <dirent.h>
  669. #include <sys/vfs.h>
  670. #include <fcntl.h>
  671. #include <termios.h>
  672. #define SYSV
  673. #define USE_WAITPID
  674. #define SIGNAL_CAST (void (*)(int))
  675. char *strdup (char *);
  676. #define USE_GETCWD
  677. #endif
  678.  
  679.  
  680. #ifdef M88K_R3
  681. #include <string.h>
  682. #include <dirent.h>
  683. #include <fcntl.h>
  684. #include <termios.h>
  685. #define STATFS4
  686. #define SYSV
  687. #define USE_WAITPID
  688. #define SIGNAL_CAST (void (*)(int))
  689. char *strdup (char *);
  690. #define USE_GETCWD
  691. #define NO_FSYNC
  692. #define NO_EID
  693. #endif
  694.  
  695.  
  696. #ifdef DNIX
  697. #include <dirent.h>
  698. #include <string.h>
  699. #include <fcntl.h>
  700. #include <sys/statfs.h>
  701. #include <sys/stropts.h>
  702. #define NO_GET_BROADCAST
  703. #define USE_WAITPID
  704. #define USE_GETCWD
  705. #define USE_SETSID
  706. #define STATFS4
  707. #define NO_EID
  708. #define PF_INET AF_INET
  709. #define NO_STRERROR
  710. #define ftruncate(f,l) chsize(f,l)
  711. #endif /* DNIX */
  712.  
  713. #ifdef CONVEX
  714. #define SIGNAL_CAST (void (*)(int))
  715. #include <netinet/tcp.h>
  716. #include <arpa/inet.h>
  717. #include <dirent.h>
  718. #include <string.h>
  719. #include <sys/vfs.h>
  720. #include <fcntl.h>
  721. #define DONT_REINSTALL_SIG
  722. #define USE_SIGBLOCK
  723. #define USE_WAITPID
  724. #define SIGNAL_CAST (_SigFunc_Ptr_t)
  725. #define NO_GETSPNAM
  726. #define HAVE_MEMMOVE
  727. extern char *mktemp(char *);
  728. extern int  fsync(int);
  729. extern int  seteuid(uid_t);
  730. extern int  setgroups(int, int *);
  731. extern int  initgroups(char *, int);
  732. extern int  statfs(char *, struct statfs *);
  733. extern int  setegid(gid_t);
  734. extern int  getopt(int, char *const *, const char *);
  735. extern int  chroot(char *);
  736. extern int  gettimeofday(struct timeval *, struct timezone *);
  737. extern int  gethostname(char *, int);
  738. extern char *crypt(char *, char *);
  739. extern char *getpass(char *);
  740. #endif
  741.  
  742.  
  743. #ifdef CRAY
  744. #define MAXPATHLEN 1024
  745. #include <dirent.h>
  746. #include <string.h>
  747. #include <fcntl.h>
  748. #include <sys/statfs.h>
  749. #define SIGNAL_CAST (void (*)(int))
  750. #define SIGCLD_IGNORE
  751. #define HAVE_FCNTL_LOCK 1
  752. #define USE_SETSID
  753. #define STATFS4
  754. #endif
  755.  
  756.  
  757. #ifdef ALTOS
  758. #include <unistd.h>
  759. #include <string.h>
  760. #include <dirent.h>
  761. #include <sys/fcntl.h>
  762. #include <sys/statfs.h>
  763. #define        const
  764. #define        uid_t           int
  765. #define        gid_t           int
  766. #define        mode_t          int
  767. #define        ptrdiff_t       int
  768.  
  769. #define HAVE_GETGRNAM  0
  770.  
  771. #define NO_EID
  772. #define NO_FSYNC
  773. #define        NO_FTRUNCATE
  774. #define        NO_GETRLIMIT
  775. #define        NO_INITGROUPS
  776. #define NO_SELECT
  777. #define NO_SETGROUPS
  778. #define NO_STRERROR
  779. #define NO_STRFTIME
  780. #define        NO_TM_NAME
  781. #define NO_UTIMEH
  782. #define NOSTRCASECMP
  783. #define REPLACE_MKTIME
  784. #define REPLACE_RENAME
  785. #define REPLACE_STRSTR
  786. #define STATFS4
  787. #define        USE_GETCWD
  788. #endif
  789.  
  790. #ifdef QNX
  791. #define STATFS4
  792. #include <sys/statfs.h>
  793. #include <sys/select.h>
  794. #include <signal.h>
  795. #include <sys/dir.h>
  796. #define SIGNAL_CAST (void (*)())
  797. #define USE_WAITPID
  798. #define NO_INITGROUPS
  799. #define NO_SETGROUPS
  800. #define HAVE_TIMEZONE
  801. #define USE_GETCWD
  802. #define USE_SETSID
  803. #define HAVE_FCNTL_LOCK 1
  804. #define DEFAULT_PRINTING PRINT_QNX
  805. #endif
  806.  
  807.  
  808. #ifdef NEWS42
  809. #include <string.h>
  810. #include <dirent.h>
  811. #include <sys/vfs.h>
  812. #include <sys/timeb.h>
  813. typedef int mode_t;
  814. #endif
  815.  
  816. #ifdef OS2
  817. #include <dirent.h>
  818. #include <sys/statfs.h>
  819. #include <string.h>
  820. #include <limits.h>
  821. #define SIGNAL_CAST (void (*)())
  822. #define HAVE_FCNTL_LOCK 0
  823. #define USE_WAITPID
  824. #define NO_GET_BROADCAST
  825. #define NO_EID
  826. #define NO_SETGROUPS
  827. #define NO_INITGROUPS
  828. #define NO_CRYPT
  829. #define NO_STATFS
  830. #define NO_CHROOT
  831. #define NO_CHOWN
  832. #define strcasecmp stricmp
  833. #define strncasecmp strnicmp
  834. #endif
  835.  
  836.  
  837. /*******************************************************************
  838. end of the platform specific sections
  839. ********************************************************************/
  840.  
  841. #ifdef REPLACE_GETPASS
  842. extern char    *getsmbpass(char *);
  843. #define getpass(s) getsmbpass(s)
  844. #endif
  845.  
  846. #ifdef REPLACE_INNETGR
  847. #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
  848. #endif
  849.  
  850. #ifndef FD_SETSIZE
  851. #define FD_SETSIZE 255
  852. #endif
  853.  
  854. #ifndef MAXINT
  855. #define MAXINT ((((unsigned)1)<<(sizeof(int)*8-1))-1)
  856. #endif
  857.  
  858. #ifndef __STDC__
  859. #define const
  860. #endif
  861.  
  862. /* Now for some other grungy stuff */
  863. #ifdef NO_GETSPNAM
  864. struct spwd { /* fake shadow password structure */
  865.        char *sp_pwdp;
  866. };
  867. #endif
  868.  
  869. #ifndef HAVE_BZERO
  870. #ifndef bzero
  871. #define bzero(p,s) memset(p,0,s)
  872. #endif
  873. #endif
  874.  
  875. #ifndef HAVE_MEMMOVE
  876. #ifndef memmove
  877. #define memmove(d,s,n) MemMove(d,s,n)
  878. #endif
  879. #endif
  880.  
  881. #ifdef USE_DIRECT
  882. #include <sys/dir.h>
  883. #endif
  884.  
  885. /* some unixes have ENOTTY instead of TIOCNOTTY */
  886. #ifndef TIOCNOTTY
  887. #ifdef ENOTTY
  888. #define TIOCNOTTY ENOTTY
  889. #endif
  890. #endif
  891.  
  892. #ifndef SIGHUP
  893. #define SIGHUP 1
  894. #endif
  895.  
  896. /* if undefined then use bsd or sysv printing */
  897. #ifndef DEFAULT_PRINTING
  898. #ifdef SYSV
  899. #define DEFAULT_PRINTING PRINT_SYSV
  900. #else
  901. #define DEFAULT_PRINTING PRINT_BSD
  902. #endif
  903. #endif
  904.  
  905.  
  906. #ifdef AFS_AUTH
  907. #include <afs/stds.h>
  908. #include <afs/kautils.h>
  909. #endif
  910.  
  911. #ifdef DFS_AUTH
  912. #include <dce/dce_error.h>
  913. #include <dce/sec_login.h>
  914. #endif
  915.  
  916. #ifdef NO_UTIMBUF
  917. struct utimbuf {
  918.   time_t actime;
  919.   time_t modtime;
  920. };
  921. #endif
  922.  
  923. #ifdef NO_STRERROR
  924. #ifndef strerror
  925. extern char *sys_errlist[];
  926. #define strerror(i) sys_errlist[i]
  927. #endif
  928. #endif
  929.  
  930. #ifndef perror
  931. #define perror(m) printf("%s: %s\n",m,strerror(errno))
  932. #endif
  933.  
  934. #ifndef MAXHOSTNAMELEN
  935. #define MAXHOSTNAMELEN 255
  936. #endif
  937.  
  938. #include "version.h"
  939. #include "smb.h"
  940. #include "byteorder.h"
  941. #ifdef SMB_PASSWD
  942. #include "smbpass.h"
  943. #endif
  944.  
  945. #include "kanji.h"
  946. #include "charset.h"
  947.  
  948. #ifndef S_IFREG
  949. #define S_IFREG 0100000
  950. #endif
  951.  
  952. #ifndef S_ISREG
  953. #define S_ISREG(x) ((S_IFREG & x)!=0)
  954. #endif
  955.  
  956. #ifndef S_ISDIR
  957. #define S_ISDIR(x) ((S_IFDIR & x)!=0)
  958. #endif
  959.  
  960. #ifdef UFC_CRYPT
  961. #define crypt ufc_crypt
  962. #endif
  963.  
  964. #ifdef REPLACE_STRLEN
  965. #define strlen(s) Strlen(s)
  966. #endif
  967.  
  968. #ifdef REPLACE_STRSTR
  969. #define strstr(s,p) Strstr(s,p)
  970. #endif
  971.  
  972. #ifdef REPLACE_MKTIME
  973. #define mktime(t) Mktime(t)
  974. #endif
  975.  
  976. #ifndef NGROUPS_MAX
  977. #define NGROUPS_MAX 128
  978. #endif
  979.  
  980. #ifndef EDQUOT
  981. #define EDQUOT ENOSPC
  982. #endif
  983.  
  984. #ifndef HAVE_GETGRNAM
  985. #define HAVE_GETGRNAM 1
  986. #endif
  987.  
  988. #ifndef SOL_TCP
  989. #define SOL_TCP 6
  990. #endif
  991.  
  992. /* default to using ftruncate workaround as this is safer than assuming
  993. it works and getting lots of bug reports */
  994. #ifndef FTRUNCATE_CAN_EXTEND
  995. #define FTRUNCATE_CAN_EXTEND 0
  996. #endif
  997.  
  998. /* maybe this unix doesn't separate RD and WR locks? */
  999. #ifndef F_RDLCK
  1000. #define F_RDLCK F_WRLCK
  1001. #endif
  1002.  
  1003. #ifndef ENOTSOCK
  1004. #define ENOTSOCK EINVAL
  1005. #endif
  1006.  
  1007. #ifndef SIGCLD
  1008. #define SIGCLD SIGCHLD
  1009. #endif 
  1010.  
  1011. #ifndef HAVE_FCNTL_LOCK
  1012. #define HAVE_FCNTL_LOCK 1
  1013. #endif
  1014.  
  1015. #ifndef WAIT3_CAST2
  1016. #define WAIT3_CAST2 (struct rusage *)
  1017. #endif
  1018.  
  1019. #ifndef WAIT3_CAST1
  1020. #define WAIT3_CAST1 (int *)
  1021. #endif
  1022.  
  1023. #ifndef QSORT_CAST
  1024. #define QSORT_CAST (int (*)())
  1025. #endif
  1026.  
  1027. /* this is a rough check to see if this machine has a lstat() call.
  1028.    it is not guaranteed to work */
  1029. #if !(defined(S_ISLNK) || defined(S_IFLNK))
  1030. #define lstat stat
  1031. #endif
  1032.  
  1033. /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
  1034. #ifndef errno
  1035. extern int errno;
  1036. #endif 
  1037.  
  1038.  
  1039. #ifdef NO_EID
  1040. #define geteuid() getuid()
  1041. #define getegid() getgid()
  1042. #define seteuid(x) setuid(x)
  1043. #define setegid(x) setgid(x)
  1044. #endif
  1045.  
  1046.  
  1047. #if (HAVE_FCNTL_LOCK == 0)
  1048. /* since there is no locking available, system includes  */
  1049. /* for DomainOS 10.4 do not contain any of the following */
  1050. /* #define's. So, to satisfy the compiler, add these     */
  1051. /* #define's, although they arn't really necessary.      */
  1052. #define F_GETLK 0
  1053. #define F_SETLK 0
  1054. #define F_WRLCK 0
  1055. #define F_UNLCK 0
  1056. #endif /* HAVE_FCNTL_LOCK == 0 */
  1057.  
  1058. #ifdef NOSTRCASECMP
  1059. #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
  1060. #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
  1061. #endif
  1062.  
  1063. #ifndef strcpy
  1064. #define strcpy(dest,src) StrCpy(dest,src)
  1065. #endif
  1066.  
  1067.  
  1068. /* possibly wrap the malloc calls */
  1069. #if WRAP_MALLOC
  1070.  
  1071. /* undo the old malloc def if necessary */
  1072. #ifdef malloc
  1073. #define xx_old_malloc malloc
  1074. #undef malloc
  1075. #endif
  1076.  
  1077. #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
  1078.  
  1079. /* undo the old realloc def if necessary */
  1080. #ifdef realloc
  1081. #define xx_old_realloc realloc
  1082. #undef realloc
  1083. #endif
  1084.  
  1085. #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
  1086.  
  1087. /* undo the old free def if necessary */
  1088. #ifdef free
  1089. #define xx_old_free free
  1090. #undef free
  1091. #endif
  1092.  
  1093. #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
  1094.  
  1095. /* and the malloc prototypes */
  1096. void *malloc_wrapped(int,char *,int);
  1097. void *realloc_wrapped(void *,int,char *,int);
  1098. void free_wrapped(void *,char *,int);
  1099.  
  1100. #endif
  1101.  
  1102.  
  1103. #if WRAP_MEMCPY
  1104. /* undo the old memcpy def if necessary */
  1105. #ifdef memcpy
  1106. #define xx_old_memcpy memcpy
  1107. #undef memcpy
  1108. #endif
  1109.  
  1110. #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
  1111. void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
  1112. #endif
  1113.  
  1114. #endif
  1115.